var MiniSite={};

MiniSite.Browser = {

	ie: /msie/.test(window.navigator.userAgent.toLowerCase()),

	version: /7.0/.test(window.navigator.userAgent.toLowerCase()),

	v6: /6.0/.test(window.navigator.userAgent.toLowerCase()),

	moz: /gecko/.test(window.navigator.userAgent.toLowerCase()),

	opera: /opera/.test(window.navigator.userAgent.toLowerCase())

};

isIE = MiniSite.Browser.ie;

function ShowBox(msgw, msgh, url, showboxtitle, ifbgcolor) {

    var msgw, msgh, bordercolor;

    titleheight = 25

    bordercolor = "#FFC830";

    titlecolor = "#B24600";

    var sWidth, sHeight;

    sWidth = document.body.offsetWidth;

    sHeight = document.body.scrollHeight;

    var bgObj = document.createElement("div");

    bgObj.setAttribute('id', 'bgDiv');

    bgObj.style.position = "absolute";

    bgObj.style.top = "0";

    bgObj.style.background = "#000";

    bgObj.style.filter = "alpha(opacity=70)";

    bgObj.style.opacity = "0.6";

    bgObj.style.left = "0";

    bgObj.style.width = sWidth + "px";

    bgObj.style.height = sHeight + "px";

    bgObj.style.zIndex = "10000";

    document.body.appendChild(bgObj);

    var msgObj = document.createElement("div")

    msgObj.setAttribute("id", "msgDiv");

    msgObj.setAttribute("align", "center");

    msgObj.style.background = ifbgcolor;

    msgObj.style.border = "1px solid " + bordercolor;

    msgObj.style.position = "absolute";

    msgObj.style.left = "50%";

    msgObj.style.top = "50%";

    msgObj.style.font = "12px/1.6em Verdana, Geneva, Arial, Helvetica, sans-serif";

    msgObj.style.marginLeft = "-225px";

    msgObj.style.marginTop = -75 + document.documentElement.scrollTop + "px";

    msgObj.style.width = msgw + "px";

    msgObj.style.height = msgh + "px";

    msgObj.style.zIndex = "10001";

    var title = document.createElement("h4");

    title.setAttribute("id", "msgTitle");

    title.setAttribute("align", "right");

    title.style.margin = "0";

    title.style.padding = "3px";

    title.style.background = bordercolor;

    title.style.filter = "progidXImageTransform.Microsoft.Alpha(startX=20, startY=20, finishX=100, finishY=100,style=1,finishOpacity=100);";

    title.style.opacity = "0.75";

    title.style.border = "1px solid " + bordercolor;

    title.style.height = "18px";

    title.style.font = "12px Verdana, Geneva, Arial, Helvetica, sans-serif";

    title.style.color = "white";

    title.style.cursor = "pointer";

    title.innerHTML = "<span><span style=\"float:left;padding-left:5px;font-weight:bold;\">" + showboxtitle + "</span><span style=\"float:right\">关闭</span></span>";

    title.title = "关闭";

    title.onclick = function() {

        document.body.removeChild(bgObj);

        document.getElementById("msgDiv").removeChild(title);

        document.body.removeChild(msgObj);

    }

    document.body.appendChild(msgObj);

    document.getElementById("msgDiv").appendChild(title);

    var txt = document.createElement("div");

    txt.style.padding = "1px";

    txt.setAttribute("id", "msgTxt");

    txt.innerHTML = '<iframe src="' + url + '&rand=' + Math.random() + '" id="jquery-overlay-mybox-iframe" name="jquery-overlay-mybox-iframe" style="width:' + (msgw - 8) + 'px;height:' + (msgh - 2) + 'px;" allowTransparency="ture" scrolling="no" frameborder="0"></iframe>';

    document.getElementById("msgDiv").appendChild(txt);

}







function ShowMessage(msgw, msgh, html, showboxtitle, ifbgcolor)

 {

    var msgw,msgh,bordercolor;

    titleheight = 25;

    bordercolor = "#26B4CC";

    titlecolor = "#26B4CC";

    var sWidth,sHeight;

    sWidth = document.body.offsetWidth;

    sHeight = document.body.scrollHeight;

/*    var bgObj = document.createElement("div");

    bgObj.setAttribute('id', 'bgDiv');

    bgObj.style.position = "absolute";

    bgObj.style.top = "0";

    bgObj.style.background = "#000";

    bgObj.style.filter = "alpha(opacity=70)";

    bgObj.style.opacity = "0.6";

    bgObj.style.left = "0";

    bgObj.style.width = sWidth + "px";

    bgObj.style.height = sHeight + "px";

    bgObj.style.zIndex = "10000";

    document.body.appendChild(bgObj);*/

    var msgObj = document.createElement("div")

    msgObj.setAttribute("id", "msgDiv");

    msgObj.setAttribute("align", "center");

    msgObj.style.background = ifbgcolor;

    msgObj.style.border = "1px solid " + bordercolor;

    msgObj.style.position = "absolute";

    msgObj.style.left = "50%";

    msgObj.style.top = "50%";

    msgObj.style.font = "12px/1.6em Verdana, Geneva, Arial, Helvetica, sans-serif";

    msgObj.style.marginLeft = "-225px";

    msgObj.style.marginTop = -75 + document.documentElement.scrollTop + "px";

    msgObj.style.width = msgw + "px";

    msgObj.style.height = msgh + "px";

    msgObj.style.zIndex = "10001";

    var title = document.createElement("h4");

    title.setAttribute("id", "msgTitle");

    title.setAttribute("align", "right");

    title.style.margin = "0";

    title.style.padding = "3px";

    title.style.background = bordercolor;

    title.style.filter = "progidXImageTransform.Microsoft.Alpha(startX=20, startY=20, finishX=100, finishY=100,style=1,finishOpacity=100);";

    title.style.opacity = "0.75";

    title.style.border = "1px solid " + bordercolor;

    title.style.height = "18px";

    title.style.font = "12px Verdana, Geneva, Arial, Helvetica, sans-serif";

    title.style.color = "white";

    title.style.cursor = "pointer";

    title.innerHTML = "<span><span style=\"float:left;padding-left:5px;font-weight:bold;\">" + showboxtitle + "</span><span style=\"float:right\">关闭</span></span>";

    title.title = "关闭";

    title.onclick = function() {

        //document.body.removeChild(bgObj);

        document.getElementById("msgDiv").removeChild(title);

        document.body.removeChild(msgObj);


    }

    document.body.appendChild(msgObj);

    document.getElementById("msgDiv").appendChild(title);

    var txt = document.createElement("div");

    txt.style.padding = "30px";

    txt.setAttribute("id", "msgTxt");

    txt.innerHTML = html;

    document.getElementById("msgDiv").appendChild(txt);

}



/*

	关闭IE 6 下的select

*/

function CloseSelect()

{

	   

		if(MiniSite.Browser.v6)

		{

			var selects = document.getElementsByTagName('select');

			var selectsLen = selects.length;

			for (var i = 0; i < selectsLen ; i++ )

			{

				document.getElementById(selects[i].id).style.visibility="hidden";

			}

			

		}

	

}

/*

	关闭弹出框

*/

function CloseShowMessage(url)

{

        //parent.document.getElementById("MessageFace").src = v;

		//parent.document.getElementById("headface").value = v;

		

		//C_bgObj  = document.getElementById("bgDiv");

		

		C_msgDiv  = document.getElementById("msgDiv");

		

	      

		

		C_msgTitle  = document.getElementById("msgTitle");

		

		//document.body.removeChild(C_bgObj);

		document.getElementById("msgDiv").removeChild(C_msgTitle); 

		document.body.removeChild(C_msgDiv);

		

		

		

		if(url!="")

		{

			

			

			

			window.location.href=url;

			

			return;

			

		}

		

		if(MiniSite.Browser.version)//解决ie 7下不能移除bgdiv

		{

			window.location.reload();	

		}

	

}

function CloseShowBox()

{

		bgObj  = parent.document.getElementById("bgDiv");

		msgDiv  = parent.document.getElementById("msgDiv");

		msgTitle  = parent.document.getElementById("msgTitle");

		

		parent.document.body.removeChild(bgObj);

		parent.document.getElementById("msgDiv").removeChild(msgTitle); 

		parent.document.body.removeChild(msgDiv); 	

		

	

	

}



function ShowAlert(msg,url)

{

	

	

	ShowMessage(300,120,'<span style="font:14px Verdana, Geneva, Arial, Helvetica, sans-serif; color:#26B4CC;">'+msg+'</span>','设置成功','#ddddde');

	return ;

	if(url!='')

	{

		setTimeout("CloseShowMessage('"+url+"')",2000);

	}

	



}



